<template>
  <div class="department-container">
    <div class="app-container">
      <el-card>
        <!-- 具体页面结构 -->
        <PageTools>
          <template v-slot:left>本月: 社保在缴 公积金在缴</template>
          <template v-slot:right>
            <el-button type="warning" size="small">导入excel</el-button>
            <el-button type="danger" size="small">导出excel</el-button>
            <el-button type="primary" size="small">新增员工</el-button></template>
        </PageTools>
      </el-card>
      <el-card style="margin-top: 10px;">
        <el-table border :data="EmployeesList" :default-sort="{prop:'workNumber',order:'ascending'}">
          <el-table-column label="序号" type="index" />
          <el-table-column label="姓名" prop="username" />
          <el-table-column sortable label="工号" prop="workNumber" />
          <el-table-column label="聘用形式" prop="fromOfEmployment" />
          <el-table-column label="部门" prop="departmentName" />
          <el-table-column sortable label="入职时间" prop="timeOfEntry" />
          <!-- <el-table-column label="账户状态" prop="" /> -->
          <el-table-column label="操作" width="280">
            <template>
              <el-button type="text" size="small">查看</el-button>
              <el-button type="text" size="small">分配角色</el-button>
              <el-button type="text" size="small">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- 分页组件 -->
        <el-row type="flex" justify="center" align="middle" style="height: 60px">
          <el-pagination layout="prev, pager, next" display:flex align:end />
        </el-row>
      </el-card>
    </div>
  </div>
</template>
<script>
import { getEmployeesList } from '@/api/employees'

export default {
  data() {
    return {
      EmployeesList: [],
      total: 0,
      pageparams: {
        page: 1,
        size: 2
      }
    }
  },
  created() {
    this.loadEmployeesList()
  },
  methods: {
    async loadEmployeesList() {
      const res = await getEmployeesList()
      console.log(res.data.rows)
      this.EmployeesList = res.data.rows
      this.total = res.data.total
    }
  }
}
</script>

